﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using facebook;
using facebook.web;
using System.Text;

public partial class Admin_Administrator : facebook.web.CanvasIFrameMasterPage
{
    private static bool[] hide = { true, true, true, true, true };
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["WB_UserId"] == null)
        {
            //olduser = null;
            Response.Redirect("/Default.aspx");
        }
        if (!IsPostBack)
        {
            //List<Category> ct = new List<Category>();

            StringBuilder sb = new StringBuilder();
            sb.Append("\n<li><a href=" + "Ebook.aspx" + ">" + "Product" + "</a></li>");
            sb.Append("\n<li><a href=" + "Order.aspx" + ">" + "Order" + "</a></li>");
            if (Session["WB_GroupUser_Id"].ToString().Equals("1"))
            {
                sb.Append("\n<li><a href=" + "Contact.aspx" + ">" + "Contact" + "</a></li>");
                sb.Append("\n<li><a href=" + "Category.aspx" + ">" + "Group Product" + "</a></li>");
                sb.Append("\n<li><a href=" + "User.aspx" + ">" + "User" + "</a></li>");
                sb.Append("\n<li><a href=" + "GroupUser.aspx" + ">" + "Group User" + "</a></li>");
            }
            //sb.Append("\n<ul>");
            //for (int i = 0; i < ct.Count; i++)
            //{
            //    sb.Append("\n<li><a href=" + "" + ">" + ct[i].Name + "</a>");
            //}
            //sb.Append("\n</ul>\n</li>");
            //sb.Append("\n<li><a href=" + "/Pages/Order.aspx" + ">" + "Giỏ hàng" + "</a></li>");
            //sb.Append("\n<li><a href=" + "/Default.aspx" + ">" + "Liên hệ" + "</a></li>");
            ltrMenu.Text = sb.ToString();
            ltrfooter.Text = "<span style=\"float:center; color: gray;\">UIT - Students</span>";
        }
    }

    protected void Linkbutton_Click(object sender, EventArgs e)
    {
        LinkButton lbt = (LinkButton)sender;
        Response.Redirect("~/Admins/" + lbt.ID.Trim() + ".aspx");
    }
    protected void lbtthoat_Click(object sender, EventArgs e)
    {
        Session.Clear();
        Response.Redirect("~/Admins/Login.aspx");
    }

    protected void imbt_Click(object sender, System.Web.UI.ImageClickEventArgs e)
    {
        hide[int.Parse((sender as ImageButton).CommandName)] = !hide[int.Parse((sender as ImageButton).CommandName)];
        Response.Redirect("~/Admins/Default.aspx");
    }
}
